import java.util.Scanner;

public class test6 {
    public static void main(String[] args) {
        //求出6个评委的打分去掉一个最低分和一个最高分
        //1 定义数组存储6个评委的打分
        int[] arr = GetScores();
        //2 求出最大值
        int max = GetMax(arr);
        //3 求出最小值
        int min = GetMin(arr);
        //4 计算求出总和
        int sum = Avg(arr);
        //q求结果
        double avg = (sum - min - max) / (arr.length - 2);
        System.out.println("ret = " + avg);

    }

    //求出平均值
    public static int Avg(int[] arr) {
        int sum = 0;
        for (int i = 0; i < arr.length; i++) {
            sum = sum + arr[i];
        }
        return sum;
    }

    //求出最大值
    public static int GetMax(int[] arr) {
        int max = arr[0];
        for (int i = 0; i < arr.length; i++) {
            if (arr[i] > max) {
                max = arr[i];
            }
        }
        return max;
    }

    //求出最小值
    public static int GetMin(int[] arr) {
        int min = arr[0];
        for (int i = 0; i < arr.length; i++) {
            if (arr[i] < min) {
                min = arr[i];
            }
        }
        return min;
    }

    public static int[] GetScores() {
        int[] arr = new int[6];
        Scanner sc = new Scanner(System.in);
        for (int i = 0; i < arr.length; ) {
            System.out.println("请输入评委打分");
            int number = sc.nextInt();
            if (number >= 1 && number <= 100) {
                arr[i] = number;
                i++;
            } else {
                System.out.println("你的输入非法");
            }
        }
        return arr;
    }
}
